package com.sq.oss.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.sq.oss.service.FileService;
import com.sq.oss.util.MinioUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author quan
 */
@RestController
public class FileController {
    //    @Resource
//    private MinioUtil minioUtil;
    @Resource
    private FileService fileService;

//    @NacosValue(value = "${storage.service.type}", autoRefreshed = true)
    private String storageType;


    @GetMapping("/testGetAllBuckets")
    public String testGetAllBuckets() throws Exception {
        //List<String> allBucket = minioUtil.getAllBucket();
        List<String> allBucket = fileService.getAllBucket();
        return allBucket.get(0);
    }

    @GetMapping("/testNacos")
    public String testNacos(){
        return storageType;
    }
}
